/**
 * 
 */
package com.gragra.applications;
import it.unimi.dsi.fastutil.objects.Object2IntAVLTreeMap;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
/**
 * @author Christoph Teichmann
 * 29.07.2013
 */
public class WriteOutBorderTags
{
	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new FileReader(args[0]));
		String line;
		Object2IntAVLTreeMap<String> one = new Object2IntAVLTreeMap<String>();
		Object2IntAVLTreeMap<String> two = new Object2IntAVLTreeMap<String>();
		Object2IntAVLTreeMap<String> three = new Object2IntAVLTreeMap<String>();
		Object2IntAVLTreeMap<String> four = new Object2IntAVLTreeMap<String>();
		while((line = br.readLine()) != null)
		{
			String[] parts = line.split("\\s+");
			if(parts.length >= 4)
			{
				int val = one.getInt(parts[0].split("\\|")[1]);
				one.put(parts[0].split("\\|")[1], val+1);
				val = two.getInt(parts[1].split("\\|")[1]);
				two.put(parts[1].split("\\|")[1], val+1);
				val = three.getInt(parts[parts.length-2].split("\\|")[1]);
				three.put(parts[parts.length-2].split("\\|")[1],val+ 1);
				val = four.getInt(parts[parts.length-1].split("\\|")[1]);
				four.put(parts[parts.length-1].split("\\|")[1],val + 1);
			}
		}
		System.out.println(one);
		System.out.println(two);
		System.out.println(three);
		System.out.println(four);
		br.close();
	}
}
